import vine from '@vinejs/vine'

export const createServiceRightSchema = vine.object({
  fkGoodsId: vine.number(),
  name: vine.string().maxLength(100),
  times: vine.number().positive(),
  giftTimes: vine.number().positive(),
  normalPrice: vine.number().positive(),
  salePrice: vine.number().positive(),
  discount: vine.number().range([1, 10]),
  giftAmount: vine.number().positive(),
  expNum: vine.number().range([1, Number.MAX_VALUE]).optional(),
  expType: vine.number().range([1, 2]),
  expUnit: vine.enum(['year', 'month', 'day']),
  status: vine.number().range([0, 1]).optional(),
  memo: vine.string().maxLength(255).optional(),
})

export const createServiceRightValidator = vine.compile(createServiceRightSchema)
